workspace(name = "com_github_p4lang_p4c")

# -- Direct dependencies. ------------------------------------------------------

load("//:bazel/p4c_deps.bzl", "p4c_deps")

p4c_deps()

# -- Load Rules Foreign CC -----------------------------------------------------

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

# This sets up some common toolchains for building targets. For more details, please see
# https://bazel-contrib.github.io/rules_foreign_cc/0.14.0/flatten.html#rules_foreign_cc_dependencies
rules_foreign_cc_dependencies()

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

# -- Dependencies of dependencies. ---------------------------------------------

load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")

boost_deps()

load("@com_github_p4lang_p4runtime//:p4runtime_deps.bzl", "p4runtime_deps")

p4runtime_deps()

# -- Dependencies of dependencies of P4Runtime. --------------------------------

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")

switched_rules_by_language(
    name = "com_google_googleapis_imports",
    cc = True,
    grpc = True,
)

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")

grpc_extra_deps()

# -- Load Buildifier (for formatting) ------------------------------------------

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "buildifier_prebuilt",
    integrity = "sha256-f4W2iKS1WOLZCZNAz7UQunF5+ClFT7qEI3C8z/tn1sw=",
    # Newer versions of Buildifier enforce the use of Starlark versions of
    # `proto_library`, `cc_{executable, library, proto_library, test}`, etc.
    # We're not ready to make that migration yet, and use an older Buildifier
    # version as a workaround.
    strip_prefix = "buildifier-prebuilt-7.3.1",
    urls = ["https://github.com/keith/buildifier-prebuilt/archive/7.3.1.tar.gz"],
)

load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

buildifier_prebuilt_deps()

load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains")

buildifier_prebuilt_register_toolchains()
